﻿<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>机构-项目</title>
<!--common-->
<link rel="stylesheet" href="/resources/src/css/lib/bootstrap.min.css">
<link rel="stylesheet" href="/resources/src/css/admin/main.css" />
<link rel="stylesheet" href="/resources/src/css/admin/user-manage.css" />
</head>
<body>

	<article class="main">
			<div class="main-wrapper">
				<section class="content">
				<form id="myForm" action="/admin/agency/${userId }/detal">
					<div class="container">
						<div class="con-body">
							<div class="toolbar clearfix">
								<div class="toolbar-left toolbar-one pull-left">
									<a href="#" id="checkout" class="pull-left">导出</a>
								</div>
								<div class="toolbar-right pull-left">
									<div class="input-icon">
										<input type="hidden" id="userId" value="${userId }"/>
										<input type="text" id="search" placeholder="输入用户名/手机/邮箱查询"/>
										<i class="iconfont icon-sousuo" id="search-btn"></i>
									</div>
								</div>
							</div>
							<div class="user-table table-responsive">
								<table class="table">
									<thead>
										<tr>
											<th>项目名</th>
											<th data-toggle="joDropdown">
												所处进度<i class="iconfont icon-caidanshaixuan"></i>
												<ul data-toggle="joMenu">
													<li><a href="">全部</a></li>
													<li><a href="">审核</a></li>
												</ul>	
											</th>
											<th>负责人</th>
											<th>项目笔记数<i id="noteCount" class="iconfont icon-paixu" data-order="0"></i></th>
											<th>项目文件数<i id="fileCount" class="iconfont icon-paixu" data-order="0"></i></th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody id="mytable">
									<c:forEach items="${page.result }" var="page">
										<tr data-userId="255">
											<td><a href="#">${page.name }</a></td>
											<td>${page.userProgress.name }</td>
											<td>${page.projectChange.user.userName }</td>
											<td>${fn:length(page.investNoteList) }</td>
											<td>${fn:length(page.investNoteList) }</td>
											<td><a href="#">查看</a></td>
										</tr>
									</c:forEach>
									<tr>
										<td colspan="6"  style="border:0"><jsp:include page="/common/adminPage.jsp" /></td>
										</tr>
									</tbody>
								</table>		
							</div>
						</div>
					</div>
					</form>
				</section>
			</div>
		</article>

	<script src="/resources/src/js/jquery-2.1.4.js"></script>
		<script src="/resources/src/js/jquery.nicescroll.js"></script>
		<script src="/resources/src/js/admin/main.js"></script>
		<script src="/resources/src/js/adminPage.js"></script>
		<script>
			$(function(){
				
				document.onkeydown = function(e){ 
	        	    var ev = document.all ? window.event : e;
	        	    if(ev.keyCode==13) {
	        	    	var value=$("#search").val().trim();
				 		var userId=$("#userId").val().trim();
				 		if(value!="" && value!=null){
				 			$.ajax({
				 				type:"post",
				 				url:"/admin/agency/"+userId+"/detal",
				 				async:true,
				 				data:{"condition":value},
				 				success:function(data){
				 					$("#mytable").html(data);
				 				}
				 			});
				 		}
	        	     }
	        	}
			
				//搜索
			 	$("#search-btn").on("click",function(){
			 		var value=$("#search").val().trim();
			 		if(value!="" && value!=null){
			 			var value=$("#search").val().trim();
				 		var userId=$("#userId").val().trim();
				 		if(value!="" && value!=null){
				 			$.ajax({
				 				type:"post",
				 				url:"/admin/agency/"+userId+"/detal",
				 				async:true,
				 				data:{"condition":value},
				 				success:function(data){
				 					$("#mytable").html(data);
				 				}
				 			});
				 		}
			 		}
			 	});
			 	
			 	//以项目笔记数排列,order为0时执行升序排列，为1时执行降序排列
			 	$("#noteCount").on("click",function(){
			 		var order=$(this).attr("data-order");
			 		if(order==="0"){
			 			//升序
			 			$(this).attr("data-order","1");
			 		}else{
			 			//降序
			 			$(this).attr("data-order","0");
			 		}
			 	});
			 	
			 	//以项目文件排列,order为0时执行升序排列，为1时执行降序排列
			 	$("#fileCount").on("click",function(){
			 		var order=$(this).attr("data-order");
			 		if(order==="0"){
			 			//升序
			 			$(this).attr("data-order","1");
			 		}else{
			 			//降序
			 			$(this).attr("data-order","0");
			 		}
			 	});
			});
		</script>

</body>
</html>